import Vue from "vue"
import VueRouter from "vue-router"
// 导入
// @符号在脚手架里代表src目录
// 如果你要找的是index.js或者index.vue，都可以省略不写
// 他会默认找里面的index.js找不到再找index.vue
import home from "@/views/home"
import layout from "@/views/layout"
import search from "@/views/search"
import play from "@/views/play"
Vue.use(VueRouter)

const routes = [
  { path: "/", redirect: "/layout/home" },
  {
    name: "layout",
    path: "/layout",
    component: layout,
    children: [
      { name: "home", path: "home", component: home, meta: { title: "首页" } },
      {
        name: "search",
        path: "search",
        component: search,
        meta: { title: "搜索" },
      },
    ],
  },
  { name: "play", path: "/play", component: play },
]

const router = new VueRouter({
  routes,
})

export default router
